############################################################## 
## MOD Title: phpBB Image verification
## MOD Author: Kailash Nadh, http://kailashnadh.name
## MOD Description: Adds an image verification system on the post (new/edit/pm..) 
## pages for un registered users, thus preventing automated posts by bots
## 
## Requires GD to function
##
## MOD Version: 1.0
## 
## Installation Level: (Intermediate) 
## Installation Time: 5 Minutes 
## Files To Edit: posting.php,post_body.tpl
## Included Files: img_verify.php 
##
## Note : Upload img_verify.php to the phpBB installation directory
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################



#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
	redirect(append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true));
}

#
#-----[ AFTER, ADD ]------------------------------------
#
 else {

	// Image verification mod (http://kailashnadh.name)
	$get_code=true;
	include "img_verify.php";

	if(isset($_POST['mode']) && isset($_POST['username'])) {
		if(empty($_POST['image_verify']) || $_POST['image_verify'] != $verify_string) {
			message_die(GENERAL_MESSAGE, "Invalid verification code!");
		} else {
			unset($_SESSION['phpbb2_img_verify']);
		}
	}

}

###

#
#-----[ FIND ]------------------------------------------
#
	$template->assign_block_vars('switch_username_select', array());

#
#-----[ AFTER, ADD ]------------------------------------
#
	$template->assign_block_vars('switch_image_verification', "");


###########


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------
#
{POLLBOX} 

#
#-----[ AFTER, ADD ]------------------------------------
#
	<!-- BEGIN switch_image_verification -->
	<tr> 
		<td class="row1">Image verification</td>
		<td class="row2"><img src="img_verify.php" alt="Image verification" /><br />
		<input type="text" name="image_verify" /></td>
	</tr>
	<!-- END switch_image_verification -->

## END MOD